﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/MasterPage/Home.Master" AutoEventWireup="true" CodeBehind="Order.aspx.cs" Inherits="TTMarketing.Admin.Order" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHeader" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceMain" runat="server">
    <asp:Panel ID="plContent" runat="server">
    <div id="close">
            <table width="100%">
                <tr>
                    <td>
                        <asp:Label ID="lblTitle" runat="server" Style="font-size: 30px" 
                            Text="Đơn hàng của khách hàng"></asp:Label>
                    </td>
                    <td align="right" width="100px">
                        <asp:Label ID="lblStt" runat="server" Text="Trạng thái "></asp:Label>
                        <telerik:RadComboBox ID="cmbClose" runat="server" AutoPostBack="True" OnSelectedIndexChanged="cmbClose_SelectedIndexChanged"
                            Width="100px">
                            <Items>
                                <telerik:RadComboBoxItem runat="server" Text="Close" Value="0" />
                                <telerik:RadComboBoxItem runat="server" Text="Open" Value="1" />
                            </Items>
                        </telerik:RadComboBox>
                    </td>
                </tr>
            </table>
        </div>
        <div id="divmessage2" runat="server">
        </div>
        <asp:Panel ID="plDetail" runat="server" Width="100%" Visible="False">
        <div id="divmessage" runat="server">
            </div>
        <fieldset>
            <legend>Thông tin đơn hàng</legend>
            
            <table width="100%">
                <tr>
                    <td width="200px">
                        <asp:Label ID="lblUserName" runat="server" Text="Họ tên khách hàng"></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="lblFullName" runat="server" Text="N/A"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td width="200px">
                        <asp:Label ID="lblUserName0" runat="server" Text="Email"></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="lblEmail" runat="server" Text="N/A"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td width="200px">
                        <asp:Label ID="lblUserName1" runat="server" Text="Điện thoại"></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="lblPhone" runat="server" Text="N/A"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td width="200px">
                        <asp:Label ID="lblUserName2" runat="server" Text="Địa chỉ"></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="lblAddress" runat="server" Text="N/A"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td width="200px">
                        <asp:Label ID="lblUserName3" runat="server" Text="Ngày tháng"></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="lblDate" runat="server" Text="N/A"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td width="200px">
                        <asp:Label ID="lblUserName4" runat="server" Text="Nội dung"></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="lblDetail" runat="server" Text="N/A"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td width="200px">
                        <asp:Label ID="lblProductList" runat="server" Text="Sản phẩm"></asp:Label>
                        <asp:ObjectDataSource ID="odsOrderDetail" runat="server" SelectMethod="getByOrder" 
                            TypeName="TTBusiness.ClassDB.clsBSOrderDetail">
                            <SelectParameters>
                                <asp:ControlParameter ControlID="hfId" Name="orderId" PropertyName="Value" 
                                    Type="Int32" />
                            </SelectParameters>
                        </asp:ObjectDataSource>
                    </td>
                    <td>
                        <telerik:RadGrid ID="rgdGrid2" runat="server" AllowPaging="True" 
                            AllowSorting="True" DataSourceID="odsOrderDetail" GridLines="None" 
                            ShowFooter="True" >
                            <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True">
                                <Selecting AllowRowSelect="True" />
                            </ClientSettings>
                            <MasterTableView AutoGenerateColumns="False" DataSourceID="odsOrderDetail">
                                <RowIndicatorColumn>
                                    <HeaderStyle Width="20px" />
                                </RowIndicatorColumn>
                                <ExpandCollapseColumn>
                                    <HeaderStyle Width="20px" />
                                </ExpandCollapseColumn>
                                <Columns>
                                    <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" HeaderText="Mã" 
                                        SortExpression="ID" UniqueName="ID">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="tblProduct.Name" DataType="System.String" 
                                        HeaderText="Tên sản phẩm" SortExpression="tblProduct.Name" UniqueName="ProductName">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Count" DataType="System.Int32" 
                                        HeaderText="Số lượng" SortExpression="Count" UniqueName="Count">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Price" DataType="System.Double" HeaderText="Giá"
                                        SortExpression="Price" UniqueName="Price">
                                    </telerik:GridBoundColumn>
                                    
                                </Columns>
                                <GroupByExpressions>
                                    <telerik:GridGroupByExpression>
                                        <GroupByFields>
                                            <telerik:GridGroupByField FieldName="Count" />
                                        </GroupByFields>
                                        <SelectFields>
                                            <telerik:GridGroupByField FieldName="Count" HeaderText="Tổng số sản phẩm" />
                                        </SelectFields>
                                    </telerik:GridGroupByExpression>
                                </GroupByExpressions>
                            </MasterTableView>
                            <HeaderContextMenu EnableAutoScroll="True">
                            </HeaderContextMenu>
                            <GroupingSettings ShowUnGroupButton="true" />
                        </telerik:RadGrid>
                    </td>
                </tr>
            </table>
            <br />
            <asp:HiddenField ID="hfId" runat="server" />
            <br />
            
        </fieldset>
    </asp:Panel>
    <asp:Panel ID="Panel2" runat="server" Width="100%">
        <telerik:RadGrid ID="rgdGrid" runat="server" AllowPaging="True" 
            AllowSorting="True" DataSourceID="odsOrder" GridLines="None" 
            ShowFooter="True" onitemcommand="rgdGrid_ItemCommand" 
            onselectedindexchanged="RadGrid1_SelectedIndexChanged">
            <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True" 
                EnablePostBackOnRowClick="True" EnableRowHoverStyle="True">
                <Selecting AllowRowSelect="True" />
            </ClientSettings>
            <MasterTableView AutoGenerateColumns="False" DataSourceID="odsOrder">
                <RowIndicatorColumn>
                    <HeaderStyle Width="20px" />
                </RowIndicatorColumn>
                <ExpandCollapseColumn>
                    <HeaderStyle Width="20px" />
                </ExpandCollapseColumn>
                <Columns>
                    <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" HeaderText="Mã" 
                        SortExpression="ID" UniqueName="ID">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="FullName" HeaderText="Họ tên khách hàng" 
                        SortExpression="FullName" UniqueName="FullName">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Email" HeaderText="Email" 
                        SortExpression="Email" UniqueName="Email">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Phone" HeaderText="Điện thoại" 
                        SortExpression="Phone" UniqueName="Phone">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Date" HeaderText="Ngày" 
                        SortExpression="Date" UniqueName="Date" DataType="System.DateTime">
                    </telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn HeaderText="Action" UniqueName="TemplateColumn">
                            <ItemTemplate>
                                <asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="~/Admin/Images/Button/Delete_Grid.gif"
                                    CommandArgument='<%# Eval("ID") %>' CommandName="delete" OnClientClick=" return confirm(&quot;Bạn có chắc chắn muốn xóa?&quot;);" />
                            </ItemTemplate>
                            <ItemStyle Width="40px" />
                    </telerik:GridTemplateColumn>
                </Columns>
            </MasterTableView>
            <HeaderContextMenu EnableAutoScroll="True">
            </HeaderContextMenu>
        </telerik:RadGrid>
        <asp:ObjectDataSource ID="odsOrder" runat="server" SelectMethod="getAll" 
            TypeName="TTBusiness.ClassDB.clsBSOrder"></asp:ObjectDataSource>
    </asp:Panel>
    </asp:Panel>
    <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" 
        EnableHistory="True">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="btnSaveNew">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="divmessage2" />
                    <telerik:AjaxUpdatedControl ControlID="rgdGrid" />
                    <telerik:AjaxUpdatedControl ControlID="plDetail" LoadingPanelID="Loading" UpdatePanelRenderMode="Inline" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnSave">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="divmessage2"  />
                    <telerik:AjaxUpdatedControl ControlID="rgdGrid"  />
                    <telerik:AjaxUpdatedControl ControlID="plDetail" LoadingPanelID="Loading" UpdatePanelRenderMode="Inline" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="rgdGrid">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rgdGrid" />
                    <telerik:AjaxUpdatedControl ControlID="cmbClose" />
                    <telerik:AjaxUpdatedControl ControlID="divmessage2"  />
                    <telerik:AjaxUpdatedControl ControlID="plDetail" LoadingPanelID="Loading" UpdatePanelRenderMode="Inline" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnReset">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="divmessage2" />
                    <telerik:AjaxUpdatedControl ControlID="rgdGrid" />
                    <telerik:AjaxUpdatedControl ControlID="plDetail" LoadingPanelID="Loading" UpdatePanelRenderMode="Inline" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnClear">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="divmessage2"  />
                    <telerik:AjaxUpdatedControl ControlID="plDetail" LoadingPanelID="Loading" UpdatePanelRenderMode="Inline" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="cmbClose">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="divmessage2"  />
                    <telerik:AjaxUpdatedControl ControlID="plDetail" LoadingPanelID="Loading" UpdatePanelRenderMode="Inline" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
</asp:Content>
